Computer systems are classically defined as having a central processing unit, memory, and input/output devices. Recent advances in integrated circuit, technology have allowed many of the classical computer functions to be integrated onto a single integrated circuit chip. These devices are known by a variety of terms such as microcontrollers, embedded controllers, microcomputers, and the like. However, they share a common characteristic in that they incorporate most classical computer functions on-chip. Because of their high level of integration, microcontrollers are ideal for applications such as automobile engine controllers, refrigerators, cellular telephones, remote controllers, and the like.
It is frequently necessary for an application using a microcontroller to have a discrete human interface input/output device in the form of a keypad. A keypad is formed by a set of keys, usually in a square or matrix form. Keys are located at the intersection of rows and columns. Each of the rows and each of the columns has a conductor associated with it. When a key is pressed, the conductors forming the intersection associated with the depressed key are mechanically contacted, forming an electrical connection.
One frequently-encountered keypad is the telephone keypad using the North American dual tone multi-frequency (DTMF) signalling system. Under this system, the keys are arranged in a matrix. When a key is pressed, a dual tone is transmitted. This dual tone consists of one tone in a low frequency band corresponding to the row of the depressed key, and one tone in a high frequency band corresponding to the column of the depressed key. An ideal microcontroller for use in such a product needs to efficiently interface to the keypad with a minimum of circuit area and power consumption.
There are two general types of known keypad interfaces used in microcontrollers. The first type uses existing registers and software. One input/output port is defined as an output port, and is connected to the rows of the keypad. Another port is defined as an input port and is connected to the columns of the keypad. First, the output port is set to a predefined pattern, such as all zeros, corresponding to a logic low state. When a key is pressed, this logic low state is transferred to the columns and the column with the depressed key is sensed by the input port. The row of the depressed key is determined by "walking" a high impedance state by selectively disabling the driving of a row. This approach results in a tradeoff between speed and the high power consumption required by pullup resistors that could quickly convert the high impedance level to a logic high level.
The second approach uses a programmable keyscan circuit. In general, this approach is not as flexible as the software approach. For example, the keyscan circuit may not be able to support some modes that are occasionally needed, such as the ability to detect multiple keys. It also requires dedicated keyscan registers, increasing integrated circuit area and die cost.
What is needed, then, is a microcontroller with a keypad interface which consumes a small amount of power, with a small increase in circuit area, and which has the flexibility to detect multiple keys. Such a microcontroller is provided by the present invention, and these and other features and advantages will be more clearly understood from the following detailed description taken in conjunction with the accompanying drawings.